package br.com.monise.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import br.com.monise.model.Caracteristicas;
import br.com.monise.model.ItensCaracteristica;
import br.com.monise.util.GenericDao;


public class ItemCaracteristicaDAO extends GenericDao<ItensCaracteristica>{
	
	public List<ItensCaracteristica> getItens(Caracteristicas caracteristica){
		EntityManager manager = getEntityManager();
		
		manager.getTransaction().begin();
        Query query = manager.createQuery("SELECT a from ItemsCaracteristica a where a.caracteristicas.pkCaracteristicas=:caracteristicas");
		query.setParameter("caracteristicas",caracteristica.getIdCaracteristicas());

		@SuppressWarnings("unchecked")
	    List<ItensCaracteristica> items = query.getResultList();

		manager.getTransaction().commit();
	//	manager.close();
		
		return items;
	}

}
